package study.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet(name = "GetRequestServlet",value = "/getRequest")
public class GetRequestServlet extends HttpServlet {
    protected void  doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取值
         String string = (String) request.getAttribute("myrequest");

        System.out.println("请求对象中获取的值为="+string);

       // response.getWriter().print("GetRequestServlet===>>");

        HttpSession session = request.getSession();

        String string1 = (String) session.getAttribute("mysession");

        response.getWriter().print("GetRequestServlet===>>session===="+string1);


    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

         doPost(request,response);
    }
}
